package server.exchange;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class BigServer {
	ServerSocket serversocket;
	
	public BigServer() throws IOException{
		this.serversocket=new ServerSocket(2013);
	}
	
	public void start()throws IOException{
		while (true){
			System.out.println("waiting for connection");
			Socket clientSocket=this.serversocket.accept();
			System.out.println("We have user!");
			InputStream is=clientSocket.getInputStream();
			ObjectInputStream ois=new ObjectInputStream(is);
			try{
				Client cl1=(Client)ois.readObject();
				System.out.println("Reading object complete "+cl1.getName());
				
			} catch (ClassNotFoundException e) {
				System.out.println("Class not found");
			}
		}
	}
}
